package psd.scala.rules

import scala.collection.mutable

import psd.model.Bug
import psd.scala.FactDb
class LowCohesion (description: String) extends AbstractRule (description){ 

  	def execute(db: FactDb): mutable.ArrayBuffer[Bug]= {
    
	    val result = new mutable.ArrayBuffer[Bug]
		val classDefTList = db.classDefTList
	    
		for ( i <- classDefTList ) {
		   if (i.methodCount > 4)  {
		     val bug = new Bug
		     bug.set_lineNumber(i.line.toInt)
		     bug.set_path(i.path)
	    	 bug.set_ruleName(this.getClass().toString())
	    	 bug.set_description(this.description)
	    	 result+=bug
		   }
		}
	
    return result
  }
  	
}